import {
  SearchBar,
  Button,
  WhiteSpace,
  WingBlank,
  Flex,
  Card,
  NoticeBar,
} from 'antd-mobile';
import React, { PureComponent } from 'react';
import DataList from '@/components/data_list';
import { connect } from 'dva';
import UserCenterFloat from '@/components/user_center_float/index';
import './index.less';
import Publish from '@/components/publish';
import Location from '@/components/location';

// @ts-ignore
@connect(({ location, global, publish, list }) => ({
  location,
  global,
  publish,
  list,
}))
export default class Home extends PureComponent {
  constructor(props: any) {
    super(props);
    // @ts-ignore
    this.props.dispatch({ type: 'list/resetSource' });
    // @ts-ignore
    this.props.dispatch({ type: 'global/flushFlag' });
  }

  render(): any {
    // @ts-ignore
    return (
      <div className={'root'}>
        <NoticeBar
          className={'notice-bar'}
          marqueeProps={{ loop: true, style: { padding: '0 7.5px' } }}
        >
          请关注微信公众号
        </NoticeBar>
        <WhiteSpace size="lg" />
        <Location />
        <WhiteSpace size="lg" />
        <div className={'data-list'}>
          <DataList />
        </div>
        <Publish />
        <UserCenterFloat />
      </div>
    );
  }
}
